#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    //链接信号与槽
    connect(this,&Widget::MySignal,this,&Widget::Myslots);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::Myslots(const QString &text)
{
    this->setWindowTitle(text);
}


void Widget::on_pushButton_clicked()
{
    emit MySignal("这是标题1");
}


void Widget::on_pushButton_2_clicked()
{
    emit MySignal("这是标题2");
}

